<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<meta name="GENERATOR" content="PasDoc 0.12.1">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Emuteca: uCHXStrUtils</title>
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#FF0000">
<h1 class="unit">Unit uCHXStrUtils</h1>
<table class="sections wide_list">
<tr>
<td><a class="section"  href="#%40Description">Description</a></td><td><a class="section"  href="#%40Uses">Uses</a></td><td>Classes, Interfaces, Objects and Records</td><td><a class="section"  href="#%40FuncsProcs">Functions and Procedures</a></td><td>Types</td><td><a class="section"  href="#%40Constants">Constants</a></td><td>Variables</td></tr></table>
<a name="%40Description"></a><h2 class="description">Description</h2>
<p>
Unit with some string related function.</p>
<a name="%40Uses"></a><h2 class="uses">Uses</h2>
<ul class="useslist"><li>Classes</li><li>crc</li><li>FileUtil</li><li>LazUTF8</li><li>LazUTF8Classes</li><li>Strutils</li><li>SysUtils</li></ul><h2 class="overview">Overview</h2>
<a name="%40FuncsProcs"></a><h3 class="summary">Functions and Procedures</h3>
<table class="summary wide_list">
<tr class="list">
<td class="itemcode"><code>function <b><a   href="uCHXStrUtils.html#AddToStringList">AddToStringList</a></b>(aList: TStrings; aString: String): integer;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a   href="uCHXStrUtils.html#CleanFileName">CleanFileName</a></b>(const AFileName: string): string;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>procedure <b><a   href="uCHXStrUtils.html#CleanStringList">CleanStringList</a></b>(aStringList: TStrings; CommentChar: string = ';');</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a   href="uCHXStrUtils.html#RemoveFromBrackets">RemoveFromBrackets</a></b>(const aString: string): string;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a   href="uCHXStrUtils.html#SecondToFmtStr">SecondToFmtStr</a></b>(aValue: int64): String;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a   href="uCHXStrUtils.html#SetAsFile">SetAsFile</a></b>(const aFileName: string): string;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a   href="uCHXStrUtils.html#SetAsFolder">SetAsFolder</a></b>(const aValue: string): string;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a   href="uCHXStrUtils.html#SetAsRelativeFile">SetAsRelativeFile</a></b>(const aFileName: string; BaseDir: string): string;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a   href="uCHXStrUtils.html#StrCount">StrCount</a></b>(aString, ToSearch: string; CaseSensitve: boolean = False): cardinal;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a   href="uCHXStrUtils.html#StrToCardinal">StrToCardinal</a></b>(const aString: String): cardinal;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a   href="uCHXStrUtils.html#StrToCardinalDef">StrToCardinalDef</a></b>(const aString: String; const Default: cardinal): cardinal;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a   href="uCHXStrUtils.html#SysPath">SysPath</a></b>(const aPath: string): string;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a   href="uCHXStrUtils.html#TextSimilarity">TextSimilarity</a></b>(const aString1, aString2: string): byte;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a   href="uCHXStrUtils.html#UnixPath">UnixPath</a></b>(const aPath: string): string;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a   href="uCHXStrUtils.html#WinPath">WinPath</a></b>(const aPath: string): string;</code></td>
</tr>
</table>
<a name="%40Constants"></a><h3 class="summary">Constants</h3>
<table class="summary wide_list">
<tr class="list">
<td class="itemcode"><code><b><a   href="uCHXStrUtils.html#kCUUTF8Delimiters">kCUUTF8Delimiters</a></b>: set of char = [#0..#127] - ['a'..'z', 'A'..'Z', '1'..'9', '0'];</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a   href="uCHXStrUtils.html#KLinuxDirSeparator">KLinuxDirSeparator</a></b> = '/';</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a   href="uCHXStrUtils.html#KWinDirSeparator">KWinDirSeparator</a></b> = '\';</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a   href="uCHXStrUtils.html#rsCUExcCardRange">rsCUExcCardRange</a></b> = '&quot;%0:d&quot; is not in cardinal range.';</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Functions and Procedures</h3>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="AddToStringList"></a><code>function <b>AddToStringList</b>(aList: TStrings; aString: String): integer;</code></td>
</tr>
<tr><td colspan="1">
<p>
Add a String to a StringList.

<p>Don't add repeated strings.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="CleanFileName"></a><code>function <b>CleanFileName</b>(const AFileName: string): string;</code></td>
</tr>
<tr><td colspan="1">
<p>
Changes some invalid characters in filenames.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="CleanStringList"></a><code>procedure <b>CleanStringList</b>(aStringList: TStrings; CommentChar: string = ';');</code></td>
</tr>
<tr><td colspan="1">
<p>
Removes comments and empty lines from a TStringList.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="RemoveFromBrackets"></a><code>function <b>RemoveFromBrackets</b>(const aString: string): string;</code></td>
</tr>
<tr><td colspan="1">
<p>
Removes text from the first '(' o '[' found in the aString.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="SecondToFmtStr"></a><code>function <b>SecondToFmtStr</b>(aValue: int64): String;</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="SetAsFile"></a><code>function <b>SetAsFile</b>(const aFileName: string): string;</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="SetAsFolder"></a><code>function <b>SetAsFolder</b>(const aValue: string): string;</code></td>
</tr>
<tr><td colspan="1">
<p>
Adds PathDelim at the end of string and changes it to '/'

<p>IncludeTrailingPathDelimiter includes the PathDelim even if aValue = ''. This function non't add it in this case, so when testing if it's empty we don't need <code>((aFolder='') or (aFolder=PathDelim))</code>

<p>In the other hand, paths are converted to Linux one as Windows AND MS-DOS (+2.0) recognise without problem</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="SetAsRelativeFile"></a><code>function <b>SetAsRelativeFile</b>(const aFileName: string; BaseDir: string): string;</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="StrCount"></a><code>function <b>StrCount</b>(aString, ToSearch: string; CaseSensitve: boolean = False): cardinal;</code></td>
</tr>
<tr><td colspan="1">
<p>
Counts the times that a substring is in a string.

<p>NOTE: <code>StrCount</code>('ooo', 'oo') = 2 .</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="StrToCardinal"></a><code>function <b>StrToCardinal</b>(const aString: String): cardinal;</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="StrToCardinalDef"></a><code>function <b>StrToCardinalDef</b>(const aString: String; const Default: cardinal): cardinal;</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="SysPath"></a><code>function <b>SysPath</b>(const aPath: string): string;</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TextSimilarity"></a><code>function <b>TextSimilarity</b>(const aString1, aString2: string): byte;</code></td>
</tr>
<tr><td colspan="1">
<p>
Returns the similarity between 2 strings.

<p>Based in <a  target="_parent" href="http://www.catalysoft.com/articles/StrikeAMatch.html">http://www.catalysoft.com/articles/StrikeAMatch.html</a> method tweaked a little.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="UnixPath"></a><code>function <b>UnixPath</b>(const aPath: string): string;</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="WinPath"></a><code>function <b>WinPath</b>(const aPath: string): string;</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
<h3 class="detail">Constants</h3>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="kCUUTF8Delimiters"></a><code><b>kCUUTF8Delimiters</b>: set of char = [#0..#127] - ['a'..'z', 'A'..'Z', '1'..'9', '0'];</code></td>
</tr>
<tr><td colspan="1">
<p>
WordDelimiters except utf8 bit mask (Dirty way &circ;_&circ;)</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="KLinuxDirSeparator"></a><code><b>KLinuxDirSeparator</b> = '/';</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="KWinDirSeparator"></a><code><b>KWinDirSeparator</b> = '\';</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="rsCUExcCardRange"></a><code><b>rsCUExcCardRange</b> = '&quot;%0:d&quot; is not in cardinal range.';</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
<hr noshade size="1"><span class="appinfo"><em>Generated by <a  target="_parent" href="http://pasdoc.sourceforge.net/">PasDoc 0.12.1</a> on 2012-10-14 16:56:28</em>
</span>
</body></html>
